using System;
using AsyncLibrary.StatusListener;

namespace AsyncLibrary
{
  /// <summary>Equips <see cref="IOperation"/> with <see cref="StatusListeners"/>
  ///   property, <see cref="CancelRequest"/> method, and <see cref="OperationFinished"/>
  ///   event</summary>
  public interface IAsyncOperation : IOperation
  {
    /// <summary>Assign <see cref="IStatusListener"/> so that opeartion can 
    ///   send progress into it, -or- null to prevent operation from reoprting 
    ///   status</summary>
    ListenersCollection StatusListeners { get; }
    /// <summary>Call this method to notify operation, that it should finish
    ///   current action, cancel the rest, and probably perform some cleanup
    ///   actions</summary>
    void CancelRequest();
    /// <summary>Is raised by operation when all actions are done</summary>
    event Action OperationFinished;
  }
}